# Python 2.6.4
# Project Euler, Problem 16
# Copyright 2010 Talha Zaman

k = str(2**1000)
tot=0
for i in range(0, len(k)):
    tot += int(k[i])
print tot

